package offer;

import java.util.HashMap;

public class Offer57 {

    public int[] twoSum(int[] nums, int target) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            map.put(nums[i],i );
        }
        for (int a:nums) {
            if (map.containsKey(target-a)){
                return  new int[]{a,target-a};
            }
        }
        return  null;
    }


}
